#include "game.h"

Game::Game()
{
	additionSymbol = new AdditionSymbol();
	subtractionSymbol = new SubtractionSymbol();
	multiplicationSymbol = new MultiplicationSymbol();
	divisionSymbol = new DivisionSymbol();

	SetupImages();
}

Game::~Game()
{
	CleanupImages();

	delete additionSymbol;
	delete subtractionSymbol;
	delete multiplicationSymbol;
	delete divisionSymbol;
}

void Game::Reset()
{
}

void Game::SetupImages()
{
	backgroundSprite = Iw2DCreateImageResource("background");
}

void Game::CleanupImages()
{
	if(backgroundSprite != NULL)
	{
		delete backgroundSprite;
		backgroundSprite = NULL;
	}

	additionSymbol->CleanupImages();
	subtractionSymbol->CleanupImages();
	multiplicationSymbol->CleanupImages();
	divisionSymbol->CleanupImages();
}

void Game::Render()
{
	Iw2DDrawImage(backgroundSprite, CIwSVec2(0, 0));

	additionSymbol->Render();
	subtractionSymbol->Render();
	multiplicationSymbol->Render();
	divisionSymbol->Render();
}

void Game::Update(int deltaTimeMs)
{
	UpdateInput(deltaTimeMs);
}

void Game::UpdateInput(int deltaTimeMs)
{
	s3ePointerUpdate();
    s3eKeyboardUpdate();
}